Skip to content

fix(object-sweep): keep rows of app query filters, sweep past refused keys, cap AddTimeout - #544

Open
pdevito3 wants to merge 1 commit into
mainfrom
fix-sweep-filters-failed-keys-add-timeout
Open

pdevito3 wants to merge 1 commit into
mainfrom
fix-sweep-filters-failed-keys-add-timeout

Conversation

@pdevito3

Copy link
Copy Markdown
Owner

Why

The object sweep could silently delete live files, or stop sweeping the bucket at one bad key, and a bad AddTimeout broke every upload with no startup error.

Closes #538
Closes #534
Closes #537

What changed

  • NamedStorageKeys ignores each named query filter of the model other than SoftDelete and Tenant. A filter that an app adds, such as one that hides archived rows, no longer hides live rows from the sweep. The names come from the whole model, so a filter on the owner that a tenant navigation joins is ignored too.
  • ObjectStorage.DeleteAsync of a batch gives the keys that storage refused instead of throwing. SweepObjects logs them as an Error, sweeps the later pages, and fails the run at the end, so BackWave runs it again. DeleteUnderAsync still throws as before.
  • AttachmentOptions.From refuses an AddTimeout over one hour, and the message names the setting.
  • docs/backend/attachments.md describes all three.

Scope

Server sweep, object storage, attachment options, their tests, and the attachments doc. No API, migration, or frontend change.

Tradeoffs

Blast Radius

The sweep job and the batch delete, which has one caller. A deploy with Attachments:AddTimeout over one hour now fails at startup.

Verification

  • dotnet test --solution FullstackTemplate.slnx: 4112 passed, 0 failed.
  • New tests, each seen failing on the old code: a sweep with an Archived filter on workshop attachments keeps the object; a sweep with one-key pages and one refused key deletes the two later orphans and fails naming the key; AddTimeout of 1:00:01 and 50 days stops the start, 1 hour starts.

… keys, cap AddTimeout

- NamedStorageKeys ignores each query filter other than SoftDelete and
  Tenant, so a filter that an app adds (such as archived rows) no longer
  hides live rows from the sweep, which then deleted their objects.
- ObjectStorage.DeleteAsync of a batch gives the keys that storage
  refused. SweepObjects logs them, sweeps the later pages, and fails the
  run at the end, so one refused key no longer stops every run at the
  same page.
- AttachmentOptions refuses an AddTimeout over one hour at the start.
  CancelAfter threw on each add over about 49.7 days.

Closes #538
Closes #534
Closes #537

Amp-Thread-ID: https://ampcode.com/threads/T-01a1fc7b-8e57-74d1-97bd-0a564a525017
Co-authored-by: Amp <amp@ampcode.com>

Copy link
Copy Markdown
Owner Author

review-gate: passed 3c310c8f0f5909f0efe38a9242611b05f4cf58c7

An independent review found no high or medium findings. It found two low ones, and both are fixed in 280577f:

  • Low 1: a filter on an owner type, joined through a tenant navigation, could still hide a live child row. The ignored filter names now come from the whole model.
  • Low 2: the sweep kept every refused key in memory but reported only 10. It now keeps a count and the first 10 keys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant